package com.my.zl.console.controller.autocode;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.my.zl.common.dto.ReqDTO;
import com.my.zl.common.dto.ResDTO;
import com.my.zl.common.dto.advancedQuery.PageQueryDTO;
import com.my.zl.console.common.aop.LogAnnotation;
import com.my.zl.console.controller.base.BaseController;
import com.my.zl.console.entity.autocode.ZlEntityAttr;
import com.my.zl.console.dto.autocode.entityAttr.ReqEntityAttrAddDTO;
import com.my.zl.console.dto.autocode.entityAttr.ReqEntityAttrDelDTO;
import com.my.zl.console.dto.autocode.entityAttr.ReqEntityAttrEditDTO;
import com.my.zl.console.dto.autocode.entityAttr.ReqEntityAttrQueryDTO;
import com.my.zl.console.dto.autocode.entityAttr.ReqEntityAttrDetailDTO;
import com.my.zl.console.dto.autocode.entityAttr.ReqEntityAttrStateDTO;
import com.my.zl.console.dto.autocode.entityAttr.ResEntityAttrAddDTO;
import com.my.zl.console.dto.autocode.entityAttr.ResEntityAttrDelDTO;
import com.my.zl.console.dto.autocode.entityAttr.ResEntityAttrEditDTO;
import com.my.zl.console.dto.autocode.entityAttr.ResEntityAttrQueryDTO;
import com.my.zl.console.dto.autocode.entityAttr.ResEntityAttrDetailDTO;
import com.my.zl.console.service.autocode.IEntityAttrService;
import com.my.zl.console.dto.autocode.entityAttr.ResEntityAttrStateDTO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 实体属性配置
 * @author ZL
 */
@Api(value="实体属性配置",tags ="实体属性配置")
@RestController
@RequestMapping("/api/autocode/entityAttr")
public class EntityAttrController extends BaseController {

    @Autowired
    private IEntityAttrService entityAttrService;
    
    /**
     * 查询
     */
    @ApiOperation(value="实体属性配置-查询")
    @RequestMapping(value="/list", method = RequestMethod.GET)
    public ResDTO<ResEntityAttrQueryDTO> listEntityAttr(ReqEntityAttrQueryDTO reqInfo,PageQueryDTO page) throws Exception{
        ResEntityAttrQueryDTO data = entityAttrService.queryEntityAttrList(reqInfo,page);
        return successDATA(data);
    }
    
   /**
     * 详情
     */
    @ApiOperation(value="实体属性配置-详情")
    @RequestMapping(value="/detail", method = RequestMethod.GET)
    public ResDTO<ResEntityAttrDetailDTO> detailEntityAttr(ReqEntityAttrDetailDTO reqInfo) throws Exception{
        ResEntityAttrDetailDTO data = entityAttrService.queryEntityAttrDetail(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 新增
     */
    @ApiOperation(value="实体属性配置-新增")
    @RequestMapping(value="/add", method = RequestMethod.POST)
    public ResDTO<ResEntityAttrAddDTO> addEntityAttr(@RequestBody ReqDTO<ReqEntityAttrAddDTO> reqInfo) throws Exception{
        ResEntityAttrAddDTO data = entityAttrService.insertEntityAttrInfo(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 编辑
     */
    @ApiOperation(value="实体属性配置-编辑")
    @RequestMapping(value="/edit", method = RequestMethod.POST)
    public ResDTO<ResEntityAttrEditDTO> editEntityAttr(@RequestBody ReqDTO<ReqEntityAttrEditDTO> reqInfo) throws Exception{
        ResEntityAttrEditDTO data = entityAttrService.updateEntityAttrInfo(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 删除
     */
    @ApiOperation(value="实体属性配置-删除")
    @RequestMapping(value="/del", method = RequestMethod.POST)
    public ResDTO<ResEntityAttrDelDTO> delEntityAttr(@RequestBody ReqDTO<ReqEntityAttrDelDTO> reqInfo) throws Exception{
        ResEntityAttrDelDTO data = entityAttrService.deleteEntityAttrInfo(reqInfo);
        return successDATA(data); 
    }
    
    /**
     * 状态更新
     */
    @ApiOperation(value="实体属性配置-状态更新")
    @RequestMapping(value="/state", method = RequestMethod.POST)
    public ResDTO<ResEntityAttrStateDTO> stateEntityAttr(@RequestBody ReqDTO<ReqEntityAttrStateDTO> reqInfo) throws Exception{
        ResEntityAttrStateDTO data = entityAttrService.updateEntityAttrState(reqInfo);
        return successDATA(data); 
    }
    
    
}